<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <button @click="fn">按钮</button>
  </div>
  <script src="./vue.js"></script>
  <script src="./vue-router.js"></script>
  <script>
    const routes = [
      {
        path: '/c/:a',
        name: 'c'
      }
    ]

    const router = new VueRouter({
      routes
    })

    const app = new Vue({
      el: '#app',
      router,
      methods: {
        fn () {
          // this.$router.push('/a?id=' + 1)
          this.$router.push({
            // path: '/c',
            name: 'c',
            /* query: {
              a: 1,
              b: 2
            } */
            params: {
              a: 1
            }
          })
        }
      }
    })
  
  </script>
</body>
</html>